
package CelestialDataStructures;

import java.util.Map;

public abstract class ForEachMapDelegate<K, V> {

    public final void doForEach(Map<K, V> map){

        beforeForEach();
        
        for(K key: map.keySet()) forEach(key, map.get(key));
        
        afterForEach();
    }
    /************************************************************************/
    /* abstract methods */
    protected abstract void beforeForEach();
    protected abstract void afterForEach();
    protected abstract void forEach(K key, V value);
}
